<template name="home">
	<view class="home-box" :class="isM == 'Modal' ? 'home-boxbigbox' : ''">
		<view class="cu-modal" :class="modalName == 'Modal' ? 'show' : ''">
			<view class="cu-dialog">
				<view class="cu-bar bg-white justify-end">
					<view class="content">未获取到定位</view>
					<view class="action" @tap="hideModal">
						<text class="cuIcon-close text-red"></text>
					</view>
				</view>
				<view class="padding-xl">
					<view class="dwtip">
						<text>请在手机设置中开启“定位”</text>
						<text>并授权给微信</text>
					</view>
					<view class>
						<button class="cu-btn bg-red margin-tb-sm lg dw" @click="opensetting">
							去设置
						</button>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-modal" :class="isM == 'Modal' ? 'show' : ''">
			<view class="cu-dialog" style="position: relative">
				<!--  <image src="/static/img/tanback.png" style="position: absolute; left: 0upx; top: 0px; z-index: 0;"  mode /> -->
				<image src="/static/img/logo02.png" class="hui" mode />
				<view class="cu-bar justify-end">
					<!--  <view class="action" @click="showM">
				<text class="cuIcon-close text-red"></text>
			  </view> -->
				</view>
				<view class="padding-xl" style="padding-top: 0upx">
					<view class="tishi" v-if="orderList">
						<!--  {{ orderList.warnLabel }} -->
						登记开门重要提示
					</view>
					<view class="dwtip2">
						<text style="text-indent: 2em">据公安部门要求，所有旅客均须如数登记，<text style="color: #3c6cfc">如有同住人，请确保<text
									style="font-weight: 700;">同时完成身份登记！</text></text>
							如若公安机关查房发现，旅客须承担相应法律责任，请您给予配合，感谢合作</text>
					</view>
					<view class="yihao" v-show="orderList && orderList.authority == 1">
						<button class="cu-btn bg-red margin-tb-sm lg dw2" @click="tocamerafromcard">
							本人登记
						</button>
						<button class="cu-btn bg-red margin-tb-sm lg dw2" @click="addperson">
							添加室友
						</button>
					</view>
					<view class="yihao" v-show="orderList && orderList.authority == 0">
						<button class="cu-btn bg-red margin-tb-sm lg dw2" @click="tocamerafromcard">
							好的，我已了解
						</button>
					</view>
				</view>
				<view style="
            position: absolute;
            left: 0upx;
            bottom: -120upx;
            width: 100%;
            text-align: center;
          ">
					<image src="../../static/img/closeBtn.png" mode="" style="width: 64upx; height: 64upx"
						@click="showM"></image>
				</view>
			</view>
		</view>
		<view class="cu-modal" :class="modalName2 == 'Modal' ? 'show' : ''">
			<view class="cu-dialog">
				<view class="cu-bar bg-white justify-end">
					<view class="content">温馨提示</view>
					<view class="action" @click="modalName2 = ''">
						<text class="cuIcon-close text-red"></text>
					</view>
				</view>
				<view class="padding-xl">
					<view class="dwtip2">
						<text>温馨提示：据公安部要求，所有入住旅客均须如实提交入住信息，严禁不登记、少登记。如若公安机关查房发现，旅客须承担相应法律责任，请您给予配合，感谢支持！</text>
					</view>
					<view class>
						<button class="cu-btn bg-red margin-tb-sm lg dw2" @click="camera">
							好的！我已经了解了
						</button>
					</view>
				</view>
			</view>
		</view>
		<!-- 登录后有||无订单 -->
		<view class="home" v-if="user">
			<view class="hubg" v-if="bannerList.length > 0">
				<banner :bannerlist="bannerList"></banner>
			</view>
			<image v-else src="/static/img/banner.png" class="hubg" mode />
			<view class="main">
				<!-- 无订单 -->
				<view class="none" v-if="orderList == ''">
					<image src="../../static/anxinsu/tuoyuan3.png" mode class="noneimg" />
					<view class="nologin1">没有找到您的客房预订信息~</view>
					<view class="nologin2">找不到订单？请使用您平台预订预留的手机号登录</view>
					<view class="nologin3" @click="loginTo()">其他号码登录></view>
					<!-- 	   <view class="tenantservice">
						<view
							class="item calls">
							<image  src="../../static/img/phone_none.png">
							<text>联系客服</text>
						</view>
						<view class="item live" >
							<image  src="../../static/img/add_none.png">
							<text>添加同住人</text>							
						</view>
          </view>-->
				</view>
				<!-- 有订单 -->
				<view class="toppart" v-if="orderList != ''">
					<view class="top">
						<!-- <text>{{ orderList.homeInfo.homeNumber }}</text> -->
					</view>
					<view class="bottom">
						<view class="l">
							<text class="zt">{{ ruz }}{{ rut }}</text>
							<text class="rud">{{ rud }}</text>
						</view>
						<view class="m" v-if="orderList.orderType == 2">共{{ totalTime }}晚</view>
						<view class="m" v-else>钟点房</view>

						<view class="r">
							<text class="zt">{{ liz }}{{ lit }}</text>
							<text class="lid">{{ lid }}</text>
						</view>
					</view>
					<view class="fang" @click="openlocation">
						<view class="name">
							<view class="detail">
								<view class="hotelName">
									<image src="../../static/anxinsu/fang.png" mode />
									{{ orderList.hotelName }}
								</view>
							</view>
						</view>
						<view class="dingweibox">
							<image src="/static/anxinsu/dingweiimg.png" mode="" class="dingweiimg" />
						</view>
					</view>
					<view class="fang1">
						<view class="name1">
							<view class="detail1">
								<view class="hotelName1">{{orderList.homeInfo.homeNumber }}</view>
							</view>
						</view>
						<view class="hotelTag">大床·无早餐·{{orderList.tenantInfoList.length}}人</view>
					</view>

					<view class="register" v-if="orderList && orderList.verify == 0">
						<view class="opendoor" @click="showM('Modal')">
							<image src="../../static/anxinsu/register.png" mode />
						</view>
					</view>
					<view class="register" v-if="orderList && orderList.verify == 1">
						<view class="opendoor">
							<view @click="opendoor">
								<image src="../../static/anxinsu/open-door.png" mode />
							</view>
						</view>
					</view>
					<!-- <view class="tenantservice">

					</view> -->
				</view>
				<view class="service">
					<view class="title">—— 智能服务 ——</view>
					<view class="intelligent" v-if="!orderList">
						<!-- <view class="item" @click="tsloginTo02">
            <image src="../../static/img/zxkf.png" mode />
            <text>保洁打扫</text>
          </view> -->
						<view class="item " @click="showcallsNo">
							<image src="../../static/anxinsu/phone.png" />
							<text>联系客服</text>
						</view>
						<view class="item " @click="addpersonNo">
							<image src="../../static/anxinsu/live.png" />
							<text>添加房客</text>
						</view>
						<view class="item" @click="serviceDialog">
							<image src="../../static/anxinsu/yytf.png" mode />
							<text>预约退房</text>
						</view>
						<view class="item" @click="topage('/pages/myorder/orderList')">
							<image src="../../static/anxinsu/kpjl.png" mode />
							<text>申请开票</text>
						</view>
						<!-- <view class="item" @click="housectrl()">
            <image src="../../static/img/fwzk.png" mode />
            <text>房屋智控</text>
          </view> -->
					</view>
					<view class="intelligent" v-if="orderList">
						<!-- <view class="item" @click="tsloginTo02">
            <image src="../../static/img/zxkf.png" mode />
            <text>保洁打扫</text>
          </view> -->
						<view class="item " @click="showcalls" v-if="orderList && orderList.serverPhone">
							<image src="../../static/anxinsu/phone.png" />
							<text>联系客服</text>
						</view>
						<view class="item " @click="addperson" v-if="orderList.authority == 1">
							<image src="../../static/anxinsu/live.png" />
							<text>添加房客</text>
						</view>
						<view class="item " @click="personDialog" v-else>
							<image src="../../static/anxinsu/add_none.png" />
							<text>添加房客</text>
						</view>
						<view class="item" @click="serviceDialog">
							<image src="../../static/anxinsu/yytf.png" mode />
							<text>预约退房</text>
						</view>
						<view class="item" @click="topage('/pages/myorder/orderList')">
							<image src="../../static/anxinsu/kpjl1.png" mode />
							<text>申请开票</text>
						</view>
					</view>
				</view>

				<view class="anxinsuimgbox">
					<image lazy-load src="../../static/anxinsu/anxinsuxiangqing.png" mode="widthFix" class="anxinsuimg"
						@click="anxinsuClick" />
				</view>

				<view class="bottompart" v-if="orderList">
					<view class="bottom">
					</view>
				</view>
			</view>
		</view>
		<!-- 默认展示 -->
		<view scroll-y style="height: 100%" class="home" v-show="!user && defaultPop">
			<view class="hubg" v-if="bannerList.length > 0">
				<banner :bannerlist="bannerList"></banner>
			</view>
			<image v-else src="/static/img/banner.png" class="hubg" mode />
			<view class="main">
				<!-- 无订单 -->
				<view class="none" @click="loginTo()">
					<image src="../../static/anxinsu/homedefauls.png" mode class="noneimg" />
					<view class="nologin4" style="font-size: 36upx">

						<text style="color: #007aff; padding-left: 8upx; padding-right: 8upx">点击登录</text>
					</view>
					<view class="nologin5">请使用您平台预订预留的手机号登录</view>
				</view>

				<view class="service">
					<view class="title">—— 智能服务 ——</view>
					<view class="intelligent">
						<!-- <view class="item" @click="tsloginTo">
							<image src="../../static/img/zxkf.png" mode />
							<text>保洁打扫</text>
						</view> -->
						<view class="item " @click="showcallsNo1">
							<image src="../../static/anxinsu/phone.png" />
							<text>联系客服</text>
						</view>
						<view class="item " @click="addpersonNo1">
							<image src="../../static/anxinsu/live.png" />
							<text>添加房客</text>
						</view>
						<view class="item" @click="tsloginTo">
							<image src="../../static/anxinsu/yytf.png" mode />
							<text>预约退房</text>
						</view>
						<view class="item" @click="topage('/pages/billingRecord/billingRecord')">
							<image src="../../static/anxinsu/kpjl.png" mode />
							<text>开票记录</text>
						</view>
						<!-- <view class="item" @click="housectrl()">
							<image src="../../static/img/fwzk.png" mode />
							<text>房屋智控</text>
						</view> -->
					</view>
				</view>
				<view class="anxinsuimgbox">
					<image lazy-load src="../../static/anxinsu/anxinsuxiangqing.png" mode="widthFix" class="anxinsuimg"
						@click="anxinsuClick" />
				</view>

			</view>
		</view>
		<!-- <view v-show="!user && showLogin">
      <image src="/static/img/login-banner.png" class="login-banner" mode />
      <login></login>
    </view> -->
		<!-- 预约退房弹窗 -->
		<wyb-popup type="center" ref="popup" width="600" height="300" radius="6" :showCloseIcon="false">
			<view class="popup-content" style="height: 100%; position: relative">
				<!-- <view style="color: #6485F0; font-size: 28upx;font-weight: 400;padding-left: 38upx;padding: 20upx 0 0 20upx;">
			  快速录入
			</view> -->

				<view class="tuidate-box">
					<view style="
              overflow: hidden;
              position: relative;
              border: 2upx solid #ebebeb;
              border-radius: 4upx;
              padding: 10upx;
            ">
						<tuidate ref="popupdate" :start="startTime" :end="endTime" @change="parentEvent"
							:appointmentTime="appointmentTime" style="
                width: 100%;
                position: absolute;
                left: 10upx;
                top: 10upx;
                z-index: 9;
              "></tuidate>
						<image src="../../static/img/rili.png" mode=""
							style="width: 40upx; height: 40upx; float: right"></image>
					</view>
				</view>
				<view class="footer">
					<button class="cu-btn" @click="closecancel" style="color: #797979; font-size: 28upx">
						取消
					</button>
					<button class="cu-btn" @click="appointment" style="color: #4382ff; font-size: 28upx">
						确定
					</button>
				</view>
			</view>
		</wyb-popup>
		<foo-bar @toIndex="toIndex" :home="0"></foo-bar>
	</view>
</template>

<script>
	import amap from "../../components/amap-wx.js";
	import {
		mapState,
		mapMutations
	} from "vuex";
	// import camera from "../../components/scan-frame/scan-frame.vue";
	// import login from "../../components/login/login.vue";
	import fooBar from '@/components/fooBar/fooBar.vue'
	import swp from "../../components/swp/swip.vue";
	import banner from "../../components/banner/banner.vue";
	import wybPopup from "@/components/wyb-popup/wyb-popup.vue";
	import tuidate from "@/components/biaofun-datetime-picker/biaofun-datetime-picker.vue";

	export default {
		name: "home",
		components: {
			// camera,
			// login,
			swp,
			banner,
			wybPopup,
			tuidate,
			fooBar
		},
		data() {
			return {
				index: "",
				startTime: "",
				tishitext: false,
				background: ["color1", "color2", "color3"],
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,
				bannerList: [],
				amapPlugin: null,
				orderinfo: [],
				login: false,
				orderList: "",
				addressName: "",
				rud: "",
				ruz: "",
				rut: "",
				lid: "",
				liz: "",
				lit: "",
				totalTime: "",
				modalName: "",
				modalName2: "",
				modalName3: "",
				showLogin: false,
				defaultPop: true,
				appointmentTime: "",
				keting: ''
			};
		},
		computed: {
			...mapState({
				user: "user",
				isM: "isM",
			}),
		},

		methods: {
			async toIndex(index) {
				let that = this
				that.index = index
				if (index == 0) {
					uni.switchTab({
						url: '/pages/home/home'
					})
				} else if (index == 1) {
					uni.switchTab({
						url: '/pages/my/home'
					})
				} else if (index == 2) {
					
				}
			},
			...mapMutations({
				setUser: "setUser",
				showM: "showM",
			}),
			anxinsuClick() {
				uni.navigateTo({
					url: "/pages/gzhPage/gzhPage",
				});
			},
			parentEvent(data) {
				this.appointmentTime = data.f1 + " " + data.hh + ":" + data.mm;
			},
			//获取banner轮播图
			getBanner() {
				this.$http
					.get("/advertisRecord/list", {
						header: {
							"content-type": "application/json;charset=UTF-8",
						} /* 会覆盖全局header */ ,
						dataType: "json",
						responseType: "text",
					})
					.then((res) => {
						let data = res.data;
						if (data.code == 0) {
							this.bannerList = res.data.data;
							console.log(this.bannerList, 9999999999)
						} else {
							uni.showToast({
								image: "/static/img/warn.png",
								title: data.msg,
								duration: 2000,
								mask: true,
							});
						}
					});
			},

			tohousectrl() {
				uni.navigateTo({
					url: "/pages/housectrl/housectrl",
				});
			},
			housectrl() {
				if (!this.user) {
					this.loginTo();
					return;
				}
				// uni.navigateTo({

				//   url:
				//     "/pages/housectrl/housectrl?smartLink=" +
				//     this.orderList.smartLink +
				//     "&verify=" +
				//     this.orderList.verify,
				// });
				let data = {
					smartLink: this.orderList.smartLink,
					verify: this.orderList.verify,
					orderList: this.orderList,
				};
				uni.setStorageSync("housectrl", data);
				uni.navigateTo({
					url: `/pages/housectrl/housectrl`,
				});
			},
			topage(v) {
				if (!this.user) {
					this.loginTo();
					return;
				}
				uni.navigateTo({
					url: v,
				});
			},
			tsloginTo02() {
				uni.showModal({
					title: "提示",
					content: "功能暂未开放！",
					success: (res) => {
						if (res.confirm) {
							console.log("用户点击确定");
						} else if (res.cancel) {
							console.log("用户点击取消");
						}
					},
				});
			},
			tsloginTo() {
				this.loginTo();
			},
			// 点击默认页  调到登录
			loginTo() {
				uni.navigateTo({
					url: "/components/login/login",
				});
			},

			checkOut() {
				//预约退房
				uni.showModal({
					title: "提示",
					content: "是否确认退房!",
					success: (res) => {
						if (res.confirm) {
							console.log("用户点击确定");
						} else if (res.cancel) {
							console.log("用户点击取消");
						}
					},
				});
			},
			houseControl() {
				uni.navigateTo({
					url: "/pages/houseControl/houseControl",
				});
			},
			calls() {
				uni.makePhoneCall({
					phoneNumber: this.orderList.serverPhone,
				});
			},
			showcalls() {
				let arr = [];
				let name = [];
				if (this.orderList.serverPhone) {
					arr.push(this.orderList.serverPhone);
					name.push("门店客服");
				}
				if (this.orderList.frontDeskPhone) {
					arr.push(this.orderList.frontDeskPhone);
					name.push("总台客服");
				}
				uni.showActionSheet({
					itemList: name,
					success: function(res) {
						console.log("选中了第" + (res.tapIndex + 1) + "个按钮");
						uni.makePhoneCall({
							phoneNumber: arr[res.tapIndex],
						});
					},
					fail: function(res) {
						console.log(res.errMsg);
					},
				});
			},
			getOrderInfo() {
				uni.showLoading({
					title: "加载中",
					mask: true,
				});
				this.$http
					.post(
						"/app/getOrderInfo",
						this.$qs.stringify({
							tenantPhoneNumber: this.user,
						}), {
							header: {} /* 会覆盖全局header */ ,
							dataType: "json",
							responseType: "text",
						}
					)
					.then((res) => {
						uni.hideLoading();
						setTimeout(function() {
							uni.stopPullDownRefresh();
						}, 500);
						let data = res.data;
						if (data.code == 0) {
							if (data.data.orderList) {
								this.orderList = data.data.orderList;
								// this.getNewLock()
							} else {
								this.orderList = "";
							}

							this.rud = this.$moment(this.orderList.entryTime).format("Mo Do");
							this.ruz = this.$moment(this.orderList.entryTime).format("dddd");
							this.rut = this.$moment(this.orderList.entryTime).format("HH:mm");
							this.lid = this.$moment(this.orderList.leaveTime).format("Mo Do");
							this.liz = this.$moment(this.orderList.leaveTime).format("dddd");
							this.lit = this.$moment(this.orderList.leaveTime).format("HH:mm");
							var date1 = new Date(this.$moment(this.orderList.entryTime));
							var date2 = new Date(this.$moment(this.orderList.leaveTime));

							var s1 = date1.getTime(),
								s2 = date2.getTime();
							console.log("---");
							console.log(s1);
							console.log(s2);
							var total = (s2 - s1) / 1000;
							console.log(total);
							var day = Math.round(total / (24 * 60 * 60));
							this.totalTime = day;
						} else {
							uni.showToast({
								image: "/static/img/warn.png",
								title: data.msg,
								duration: 2000,
								mask: true,
							});
						}
					})
					.catch((err) => {});
			},
			camera() {
				this.modalName2 = "";
				if (this.orderList.verify == 1) {
					if (/http/.test("http")) {
						uni.navigateTo({
							url: "/pages/opendoor/opendoor?item=" +
								JSON.stringify({
									openkey: this.orderList.openKey,
									entryTime: this.orderList.entryTime,
									leaveTime: this.orderList.leaveTime,
								}),
						});
					} else {
						uni.navigateTo({
							url: "/pages/hub2/hub2",
						});
					}
				} else {
					// uni.navigateTo({
					// 	url: "/pages/check/check?item=" + JSON.stringify(this.orderList),
					// 	animationType: "slide-in-bottom"
					// });
					this.maprestful(this.longitude, this.latitude, this.orderList.homeId);
				}
			},

			maprestful(longitude, latitude, homeId) {
				uni.showLoading({
					title: "提交中",
					mask: true,
				});
				this.$http
					.post(
						"/app/MapPositioning",
						this.$qs.stringify({
							longitude: longitude,
							latitude: latitude,
							homeId: homeId,
						}), {
							header: {} /* 会覆盖全局header */ ,
							dataType: "json",
							responseType: "text",
						}
					)
					.then((res) => {
						uni.hideLoading();
						let data = res.data;

						if (data.code == 0) {
							uni.setStorageSync("orderList", this.orderList);
							if (this.orderList.ocrIdcardStatus == 0) {
								uni.navigateTo({
									url: "/pages/check/check",
									animationType: "slide-in-bottom",
								});
							} else {
								uni.navigateTo({
									url: "/pages/ocr/ocr",
									animationType: "slide-in-bottom",
								});
							}
						} else {
							uni.showToast({
								image: "/static/img/warn.png",
								title: data.msg,
								duration: 2000,
								mask: true,
							});
						}
					})
					.catch((err) => {});
			},
			addperson() {
				//添加同住人
				this.showM("");
				uni.setStorageSync("person", this.orderList);
				uni.navigateTo({
					//url: "/pages/addperson/add"
					url: "/pages/addperson/addperson",
				});
			},
			clear() {
				//保洁
				uni.navigateTo({
					url: "/pages/clear/clear",
				});
			},
			opendoor() {
				// if (!this.addressName) {
				// 	this.modalName = "Modal";
				// 	return;
				// }
				this.$http
					.get(
						"/accessControl/checkAbutment/query", {
							homeId: this.orderList.homeId,
						}, {
							header: {
								"content-type": "application/json;charset=UTF-8",
							} /* 会覆盖全局header */ ,
							dataType: "json",
							responseType: "text",
						}
					)
					.then(async (res) => {
						console.log(res);
						if (res.data.data === true) {
							uni.navigateTo({
								url: "/pages/menjin/menjin?homeId=" + this.orderList.homeId,
							});
						} else {
							let lockres = await this.$http
								.get(
									"/platform/room/select", {
										homeId: this.orderList.homeId,
										platformSourceType: 5,
									}, {
										header: {
											"content-type": "application/json;charset=UTF-8",
										} /* 会覆盖全局header */ ,
										dataType: "json",
										responseType: "text",
									}
								)
							console.log(lockres)
							if (lockres.data.data) {
								this.keting = lockres.data.data
							} else {
								this.keting = {
									extColA: ''
								};
							}
							uni.navigateTo({
								url: "/pages/opendoor/opendoor?extColA=" + this.keting.extColA,
							});
						}
					});
			},
			// call() {
			//     uni.makePhoneCall({
			//         phoneNumber: "400 188 2160" //仅为示例
			//     });
			// },
			opensetting() {
				wx.openSetting({
					success: function(osrs) {
						// 出发条件是返回的时候
						wx.getUserInfo({
							success: function(getuserinfo) {},
							fail: function(fres) {},
						});
					},
				});
			},
			hideModal() {
				this.modalName = "";
			},
			tocamera() {
				this.modalName2 = "Modal";
			},
			tocamerafromcard() {
				this.showM("");
				this.modalName2 = "";

				if (this.orderList.verify == 1) {
					if (/http/.test("http")) {
						uni.navigateTo({
							url: "/pages/opendoor/opendoor?item=" +
								JSON.stringify({
									openkey: this.orderList.openKey,
									entryTime: this.orderList.entryTime,
									leaveTime: this.orderList.leaveTime,
								}),
						});
					} else {
						uni.navigateTo({
							url: "/pages/hub2/hub2",
						});
					}
				} else {
					// uni.navigateTo({
					// 	url: "/pages/check/check?item=" + JSON.stringify(this.orderList),
					// 	animationType: "slide-in-bottom"
					// });
					this.maprestful(this.longitude, this.latitude, this.orderList.homeId);
				}
			},
			totzrinfo() {
				uni.setStorageSync("person", this.orderList);
				uni.navigateTo({
					url: "/pages/tzrinfo/tzrinfo",
				});
			},

			//预约
			appointment() {
				let user = uni.getStorageSync("phone");

				if (this.appointmentTime == "") {
					uni.showToast({
						icon: "none",
						title: "请选择退房日期！",
						duration: 2000,
					});
					return;
				}
				let phoneNumber = "";
				let tenantName = "";
				for (let i = 0; i < this.orderList.tenantInfoList.length; i++) {
					if (this.orderList.tenantInfoList[i].tenantPhoneNumber == user) {
						phoneNumber = this.orderList.tenantInfoList[i].tenantPhoneNumber;
						tenantName = this.orderList.tenantInfoList[i].tenantName;
					}
				}
				this.$http
					.post(
						"/appointment/add", {
							appointmentTime: this.appointmentTime + ":00", // (string, optional),
							entryTime: this.$moment(this.orderList.entryTime).format(
								"YYYY-MM-DD HH:mm:ss"
							), // (string, optional): 入店时间 ,
							homeNumber: this.orderList.homeInfo.homeNumber, //(string, optional): 房间号 ,
							hotelId: this.orderList.homeInfo.hotelId, // (string, optional): 门店Id ,
							hotelName: this.orderList.hotelName, //(string, optional): 门店名称 ,
							leaveTime: this.$moment(this.orderList.leaveTime).format(
								"YYYY-MM-DD HH:mm:ss"
							), // (string, optional): 离店时间 ,
							orderNumber: this.orderList.orderNumber, // (string, optional): 订单号 ,
							phoneNumber: phoneNumber, // (string, optional): 下单人手机号 ,
							tenantName: tenantName, // (string, optional): 下单人姓名
						}, {
							header: {
								"Content-Type": "application/json;charset=UTF-8",
							},
							dataType: "json",
							responseType: "text",
						}
					)
					.then((res) => {
						uni.hideLoading();
						let data = res.data;

						if (data.code == 0) {
							uni.showToast({
								icon: "none",
								title: "预约成功！",
								duration: 2000,
							});
							this.$refs.popup.hide();
							this.appointmentTime = "";
						} else {
							uni.showToast({
								icon: "none",
								title: data.msg,
								duration: 2000,
							});
						}
					})
					.catch((err) => {});
			},
			showcallsNo() {
				if (this.orderList && this.orderList.verify == 1) {
					this.$http
						.get(
							"/appointment/check", {
								orderNumber: this.orderList.orderNumber,
							}, {
								header: {
									"content-type": "application/json;charset=UTF-8",
								} /* 会覆盖全局header */ ,
								dataType: "json",
								responseType: "text",
							}
						)
						.then((res) => {
							if (res.data.code == 0) {
								if (!res.data.data) {
									//this.appointment();

									this.$refs.popup.show();
									this.startTime = this.$moment(new Date()).format(
										"YYYY-MM-DD HH:mm"
									);

									this.tishitext = true;
								} else {
									uni.showToast({
										icon: "none",
										title: "已成功预约退房，如有变动请联系客服。",
										duration: 2000,
									});
								}
							} else {
								uni.showToast({
									image: "/static/img/warn.png",
									title: data.msg,
									duration: 2000,
									mask: true,
								});
							}
						})
						.catch((err) => {});
				} else if (this.orderList && this.orderList.verify == 0) {
					uni.showModal({
						title: "提示",
						content: "您还没有登记！",
						success: (res) => {
							if (res.confirm) {} else if (res.cancel) {}
						},
					});
				} else {
					uni.showModal({
						title: "提示",
						content: "暂无订单！",
						success: (res) => {
							if (res.confirm) {
								console.log("用户点击确定");
							} else if (res.cancel) {
								console.log("用户点击取消");
							}
						},
					});
				}
			},

			addpersonNo() {
				if (this.orderList && this.orderList.verify == 1) {
					this.$http
						.get(
							"/appointment/check", {
								orderNumber: this.orderList.orderNumber,
							}, {
								header: {
									"content-type": "application/json;charset=UTF-8",
								} /* 会覆盖全局header */ ,
								dataType: "json",
								responseType: "text",
							}
						)
						.then((res) => {
							if (res.data.code == 0) {
								if (!res.data.data) {
									//this.appointment();

									this.$refs.popup.show();
									this.startTime = this.$moment(new Date()).format(
										"YYYY-MM-DD HH:mm"
									);

									this.tishitext = true;
								} else {
									uni.showToast({
										icon: "none",
										title: "已成功预约退房，如有变动请联系客服。",
										duration: 2000,
									});
								}
							} else {
								uni.showToast({
									image: "/static/img/warn.png",
									title: data.msg,
									duration: 2000,
									mask: true,
								});
							}
						})
						.catch((err) => {});
				} else if (this.orderList && this.orderList.verify == 0) {
					uni.showModal({
						title: "提示",
						content: "您还没有登记！",
						success: (res) => {
							if (res.confirm) {} else if (res.cancel) {}
						},
					});
				} else {
					uni.showModal({
						title: "提示",
						content: "暂无订单！",
						success: (res) => {
							if (res.confirm) {
								console.log("用户点击确定");
							} else if (res.cancel) {
								console.log("用户点击取消");
							}
						},
					});
				}
			},

			showcallsNo1() {
				uni.navigateTo({
					url: "/components/login/login",
				});
			},
			addpersonNo1() {
				uni.navigateTo({
					url: "/components/login/login",
				});
			},
			serviceDialog() {
				//  没有订单状态  点击只能服务项  弹窗提示

				if (this.orderList && this.orderList.verify == 1) {
					this.$http
						.get(
							"/appointment/check", {
								orderNumber: this.orderList.orderNumber,
							}, {
								header: {
									"content-type": "application/json;charset=UTF-8",
								} /* 会覆盖全局header */ ,
								dataType: "json",
								responseType: "text",
							}
						)
						.then((res) => {
							if (res.data.code == 0) {
								if (!res.data.data) {
									//this.appointment();

									this.$refs.popup.show();
									this.startTime = this.$moment(new Date()).format(
										"YYYY-MM-DD HH:mm"
									);

									this.tishitext = true;
								} else {
									uni.showToast({
										icon: "none",
										title: "已成功预约退房，如有变动请联系客服。",
										duration: 2000,
									});
								}
							} else {
								uni.showToast({
									image: "/static/img/warn.png",
									title: data.msg,
									duration: 2000,
									mask: true,
								});
							}
						})
						.catch((err) => {});
				} else if (this.orderList && this.orderList.verify == 0) {
					uni.showModal({
						title: "提示",
						content: "您还没有登记！",
						success: (res) => {
							if (res.confirm) {} else if (res.cancel) {}
						},
					});
				} else {
					uni.showModal({
						title: "提示",
						content: "暂无订单！",
						success: (res) => {
							if (res.confirm) {} else if (res.cancel) {}
						},
					});
				}
			},
			closecancel() {
				this.$refs.popup.hide(); // 隐藏
				this.appointmentTime = "";
			},
			personDialog() {
				//没有订单状态  点击只能服务项  弹窗提示
				uni.showModal({
					title: "提示",
					content: "无权限！",
					success: (res) => {
						if (res.confirm) {} else if (res.cancel) {}
					},
				});
			},
			//打开地图
			openlocation() {
				let latitude = parseFloat(this.orderList.hotelLocalLongitude);
				let longitude = parseFloat(this.orderList.hotelLocalLatitude);
				uni.openLocation({
					latitude: latitude,
					longitude: longitude,
					success: function() {
						console.log("success");
					},
				});
			},
			//乐町
			getNewLock() {
				this.keting = {
					extColA: ''
				};
				//判断是不是新锁
				this.$http
					.get(
						"/platform/room/select", {
							homeId: this.orderList.homeId,
							platformSourceType: 5,
						}, {
							header: {
								"content-type": "application/json;charset=UTF-8",
							} /* 会覆盖全局header */ ,
							dataType: "json",
							responseType: "text",
						}
					)
					.then((res) => {
						console.log(res);
						if (res.data.data) {
							this.keting = res.data.data
						} else {
							this.keting = {
								extColA: ''
							};
						}
					});
			},
		},
		onShow() {
			this.startTime = this.$moment(new Date()).format("YYYY-MM-DD HH:mm");
			this.getBanner();
			uni.showShareMenu({
				withShareTicket: true,
			});
			let user = uni.getStorageSync("phone");
			this.setUser(user);
			if (this.user) {
				this.getOrderInfo();
			}
			if (this.user) {
				wx.setNavigationBarTitle({
					title: "订单详情",
				});
			} else {
				wx.setNavigationBarTitle({
					title: "登录",
				});
			}
			if (!this.user) {
				return;
			}
			this.amapPlugin = new amap.AMapWX({
				key: "4d51e1f3b1788251346be629f6d48d83",
			});
			// uni.showLoading({
			// 	title: "获取信息中"
			// });
			uni.showLoading({
				title: "获取信息中",
				mask: true,
			});
			this.amapPlugin.getRegeo({
				success: (data) => {
					setTimeout(function() {
						uni.hideLoading();
					}, 500);
					this.addressName = data[0].name;
					this.latitude = data[0].latitude;
					this.longitude = data[0].longitude;
				},
				fail: (err) => {
					uni.hideLoading();
				},
			});
		},
		onShareAppMessage: function(res) {
			if (res.from === "button") {}
			return {
				title: "e秒安心住",
				imageUrl: "/static/img/fenxiang.png",
				path: "/pages/home/home",
				success: function(res) {
					console.log("成功", res);
				},
			};
		},
		onPullDownRefresh() {
			uni.showToast({
				title: '',
				icon: 'loading',
				duration: 500
			})
			this.getBanner();
			//下拉刷新
			if (this.user) {
				this.getOrderInfo(); //当前页面舒心的 order
			}
			uni.stopPullDownRefresh();
		},
		watch: {
			user() {
				this.login = this.user;

				if (this.user) {
					this.getOrderInfo();
					wx.setNavigationBarTitle({
						title: "订单详情",
					});
				} else {
					wx.setNavigationBarTitle({
						title: "登录",
					});
				}
			},
		},

		onLoad() {
			this.modalName = "";
			this.login = this.user;
		},
	};
</script>

<style lang="scss">
	.tuidate-box {
		padding: 80upx 40upx 0upx 40upx;
	}

	.tuidate-box input {
		margin-top: 10upx;
		height: 74upx;
		border: 1upx solid #ebebeb;
		border-radius: 4upx;
		padding-left: 30upx;
	}

	.footer {
		position: absolute;
		left: 0upx;
		bottom: 0upx;
		width: 100%;
		border-top: 1px solid #ebebeb;
	}

	.footer button {
		width: 50%;
		height: 90upx;
		background: #fff !important;
		font-size: 40upx;
		border-radius: 0px;
	}

	.footer button:nth-of-type(1) {
		border-right: 1upx solid #ebebeb;
	}

	.home-boxbigbox {
		height: 100% !important;
		overflow-y: hidden;
	}

	.cu-modal {
		.content {
			font-size: 16px !important;
			font-family: AlibabaPuHuiTiR !important;
			font-weight: 400 !important;
			color: rgba(60, 108, 252, 1) !important;
		}

		.dwtip {
			font-size: 12px;
			font-family: AlibabaPuHuiTiR;
			font-weight: 400;
			color: rgba(121, 121, 121, 1);
			display: flex;
			flex-direction: column;
			justify-content: center;
			line-height: 20px;
		}

		.dwtip2 {
			font-size: 30upx;
			font-family: Alibaba PuHuiTi;
			font-weight: 400;
			color: black;
			display: flex;
			line-height: 30px;
			text-align: left;
			word-wrap: break-word;
			padding-top: 20upx;
			padding-bottom: 40upx;
		}

		.dw {
			background: rgba(60, 108, 252, 1);
			border-radius: 7px;
			margin-top: 20px;
			width: 104px;
		}

		.tip {
			font-weight: bolder;
			font-size: 20px;
			margin-bottom: 20px;
		}

		.dw2 {
			background: #3c6cfc;
			border-radius: 8upx;
			margin-top: 20upx;
			font-size: 32upx;
			width: auto;
			height: 80upx;
			line-height: 48upx;
			padding-left: 26upx;
			padding-right: 26upx;
		}
	}

	.home {
		// padding: 24upx;

		.main {
			margin-top: 250upx;
			position: relative;

			.none {
				.tenantservice {
					width: 100%;
					overflow: hidden;
					padding: 60upx 96upx 40upx 96upx;

					.item {
						width: 120upx;
						float: left;
						text-align: center;

						image {
							width: 56upx;
							height: 56upx;
						}

						text {
							display: block;
							width: 100%;
							font-size: 24upx;
							color: #ccc;
						}
					}

					.live {
						float: right;
					}
				}

				box-shadow: 4px 7px 10px 0px rgba(0, 0, 0, 0.08);
				margin-left: 24upx;
				margin-right: 24upx;
			}

			.toppart {
				border-radius: 16upx;
				background: white;
				display: flex;
				flex-direction: column;
				align-items: center;
				padding-bottom: 40upx;
				margin-left: 24upx;
				margin-right: 24upx;
				box-shadow: -2px 2px 5px 2px #f2f2f2, 2px -2px 5px 0px #f2f2f2;

				.fang {
					width: 95%;
					margin-top: 30upx;
					display: flex;
					// justify-content: space-between;
					align-items: center;
					border-top: 1px solid #e8eeff;
					border-bottom: 1px solid #e8eeff;
					padding: 30rpx 30rpx;

					.name {
						align-items: center;
						font-size: 14px;
						font-family: AlibabaPuHuiTiR;
						font-weight: 400;
						color: #000;

						.detail {
							// width: calc(100% - 80upx);
							font-size: 32upx;
							font-family: AlibabaPuHuiTiR;
							font-weight: 400;
							color: #6e92fd;
							float: left;
							line-height: 60rpx;

							.address {
								width: 100%;
								font-size: 24upx;
								color: #c0c0c0;
								overflow: hidden;
								white-space: nowrap;
								text-overflow: ellipsis;

							}

							.hotelName {
								width: 560rpx;
								font-weight: 700;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							}
						}

						image {
							width: 45rpx;
							height: 48rpx;
							margin-right: 20upx;
							float: left;
						}
					}
				}

				.fang1 {
					width: 95%;
					padding: 0 30upx;
					margin-top: 30upx;
					display: flex;
					justify-content: space-between;
					align-items: center;

					.name1 {
						align-items: center;
						font-size: 14px;
						font-family: AlibabaPuHuiTiR;
						font-weight: 400;
						color: #000;
						overflow: hidden;

						.detail1 {
							font-size: 36upx;
							font-family: AlibabaPuHuiTiR;
							font-weight: 700;
							color: #262626;
							float: left;
							line-height: 60rpx;
						}
					}

					.hotelTag {
						color: #BFBFBF;
						font-size: 24rpx;
					}
				}

				.register {
					width: 100%;
					text-align: center;
					padding: 0 30upx;
					padding-top: 50upx;

					.opendoor {
						display: inline-block;

						image {
							// width: 208upx;
							height: 96upx;
						}
					}
				}

				.tenantservice {
					width: 100%;
					overflow: hidden;
					padding: 0 96upx;

					.item {
						width: 120upx;
						float: left;
						text-align: center;

						image {
							width: 56upx;
							height: 56upx;
						}

						text {
							display: block;
							width: 100%;
							font-size: 24upx;
							color: #000;
						}
					}

					.live {
						float: right;
					}
				}

				.top {
					padding-top: 50upx;
					width: 100%;
					text-align: center;

					text {
						display: inline-block;
						width: 46%;
						height: 68rpx;
						line-height: 68rpx;
						border-radius: 34rpx;
						font-size: 36rpx;
						color: #6484f1;
						text-align: center;
						border: 1rpx solid #6484f1;
					}
				}

				.bottom {
					display: flex;
					align-items: center;
					justify-content: space-around;
					width: 100%;
					margin-top: 10px;

					.rud,
					.lid {
						font-size: 36upx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #000;
					}

					.zt {
						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #797979;
					}

					.l {
						display: flex;
						flex-direction: column;
					}

					.r {
						display: flex;
						flex-direction: column;
					}

					.m {
						height: 46upx;
						line-height: 46upx;
						border-radius: 23upx;
						padding: 0 30upx;
						font-size: 24upx;
						color: #878787;
						border: 2rpx solid #878787;
						letter-spacing: 4rpx;
					}
				}
			}

			.bottompart {
				// padding: 0 20px 20px 20px;
				border-radius: 0px 0px 8upx 8upx;
				background: white;
				margin-top: 10upx;

				.top {
					border-bottom: 1px solid #f5f5f5;
					display: flex;
					justify-content: space-between;
					align-items: center;
					height: 22upx;
					padding: 20upx 0 20upx 0;

					.address {
						font-size: 14px;
						font-family: AlibabaPuHuiTiR;
						font-weight: 400;
						color: rgba(121, 121, 121, 1);
					}

					.l,
					.r {
						display: flex;
						align-items: center;
					}

					.r {
						color: #ffb06e;
					}

					.dingwei {
						height: 20px;
						width: 20px;
						margin-right: 5px;
					}

					.dingjian {
						height: 8px;
						width: 8px;
						margin-left: 5px;
					}
				}

				.title {
					margin-top: 20px;
					font-size: 18px;
					font-family: AlibabaPuHuiTiM;
					font-weight: 500;
					color: rgba(121, 121, 121, 1);
				}

				.info {
					padding: 20px;
					color: #757575;
					background: rgba(0, 204, 202, 0.04);
					// opacity: 0.04;
					border-radius: 8px;
					font-size: 14px;
					font-family: AlibabaPuHuiTiR;
					font-weight: 400;
					color: rgba(121, 121, 121, 1);
					margin-top: 20px;
				}

				.jia {
					width: 100%;
					height: 72px;
					background: rgba(0, 204, 202, 0.04);
					border-radius: 8px;
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;
					margin-top: 20px;
					font-size: 12px;
					font-family: AlibabaPuHuiTiR;
					font-weight: 400;
					color: rgba(0, 204, 202, 1);
				}

				.jia img {
					width: 19px;
					height: 19px;
					margin-bottom: 10px;
				}
			}



			.service {
				margin-top: 30rpx;
				margin-bottom: 22rpx;
				background: white;
				box-shadow: -2px 2px 5px 2px #f2f2f2, 2px -2px 5px 0px #f2f2f2;
				padding: 40upx 50upx;
				margin-left: 24upx;
				margin-right: 24upx;
				border-radius: 16upx;

				.title {
					display: flex;
					justify-content: center;
					font-size: 32upx;
					font-weight: bold;
					font-family: "Microsoft YaHei" ! important;
					color: #000;
					margin-bottom: 20upx;
					padding: 0upx 0upx 24upx 24upx;
				}

				.intelligent {
					display: flex;
					justify-content: space-between;

					.item {
						display: inline-block;
						// flex: 1 1 auto;
						text-align: center;
						width: 120rpx;

						text {
							display: block;
							width: 100%;
							font-size: 24upx;
							color: #000;
						}

						image {
							width: 48upx;
							height: 48upx;
						}
					}
				}

			}

			.advertisement {
				display: flex;
				margin-left: 24upx;

				.item {
					flex: 1 1 auto;
					padding: 0 32upx;

					image {
						width: 100%;
						height: 147upx;
						border-radius: 16upx;
					}
				}
			}
		}
	}

	.hubg {
		position: fixed;
		top: 0;
		height: 400upx;
		width: 100%;
	}

	.login-banner {
		height: 625upx;
		width: 100%;
	}

	.none {
		display: flex;
		justify-content: center;
		flex-direction: column;
		text-align: center;
		align-items: center;
		border-radius: 8px;
		background: white;
		padding-top: 30rpx;
	}

	.mei {
		font-size: 25px;
		color: #7e7e7e;
		text-align: center;
		margin-top: 40upx;
		margin-bottom: 80upx;
	}

	.zixun {
		font-size: 12px;
		color: #ffb06e;
		margin-top: 10px;
		margin-bottom: 80px;
	}

	.noneimg {
		height: 300rpx;
		width: 340rpx;
	}

	.lb {
		display: flex;
		align-items: center;
	}

	.label {
		width: 70px;
		text-align: justify;
		text-align-last: justify;
	}

	.ruzhuadd {
		display: flex;
		padding: 23px 0px;
		justify-content: center;
	}

	.ruzhuadd .dingjian {
		width: 9px;
		height: 9px;
	}

	.ruzhu,
	.add {
		display: flex;
		justify-content: center;
		flex-direction: column;
		align-items: center;
		flex: 1;
		border-left: 2px solid rgba(245, 245, 245, 1);
	}

	.ruzhu .name,
	.add .name {
		font-size: 14px;
		font-family: Alibaba PuHuiTi;
		font-weight: 500;
		color: rgba(121, 121, 121, 1);
	}

	.ruzhu .text,
	.add .text {
		font-size: 12px;
		font-family: Alibaba PuHuiTi;
		font-weight: 400;
		color: rgba(121, 121, 121, 1);
	}

	.dh {
		display: flex;
		align-items: center;
	}

	.yihao {
		display: flex;
		justify-content: space-around;
	}

	.hui {
		height: 71px;
		width: 71px;
		position: absolute;
		z-index: 9999999999999;
		left: 50%;
		margin-left: -35px;
		top: -30px;
	}

	.cu-dialog {
		overflow: initial;

		.padding-xl {
			padding-bottom: 60upx;
		}
	}

	.tishi {
		font-size: 38upx;
		font-family: Alibaba PuHuiTi;
		font-weight: bold;
		color: rgba(0, 0, 0, 1);
		margin-bottom: 28upx;
	}

	.cu-dialog {
		width: 569upx !important;
		box-shadow: 5upx 9upx 142upx 0upx rgba(60, 108, 252, 0.79);
	}

	.gang {
		background: #ff7e00;
		line-height: 1px;
		width: 15px;
		height: 1px;
		margin: 0 5px;
	}

	.home {
		background: #fff;
	}

	.home-box {
		background: #fff;
		min-height: 100%;
		height: auto;
		width: 100%;
		overflow-x: hidden;
	}

	.youlan {
		height: 40rpx;
		width: 40rpx;
	}

	.dingweiimg {
		width: 16rpx;
		height: 22rpx;
	}

	.dingweibox {
		margin-left: 30rpx;
	}

	.anxinsuimgbox {
		padding: 0 20rpx;
		margin-top: 30rpx;
	}

	.anxinsuimg {
		width: 100%;
	}

	.nologin1 {
		text-align: center;
		color: black;
		font-size: 36rpx;
		margin-top: 5px;
		font-weight: bold;
	}

	.nologin2 {
		font-weight: 200;
		text-align: center;
		font-size: 30rpx;
		margin-top: 16rpx;
	}

	.nologin3 {
		text-align: center;
		font-size: 30rpx;
		margin-top: 30rpx;
		margin-bottom: 10px;
		font-weight: 700;
		color: #007aff;
	}

	.nologin4 {
		margin-top: 24rpx;
		color: black;
		font-size: 36rpx;
		font-weight: bold;
	}

	.nologin5 {
		margin-top: 24rpx;
		margin-bottom: 50rpx;
		font-size: 30rpx;
		font-weight: 100;
	}
</style>